Coupon Templates 优惠券模板
在向用户发放优惠券之前,需要通过 coupon_template 对象创建优惠券模板(领取中心的"优惠券"),优惠券模板记录了优惠券的折扣规则和有效期等信息。
| 属性 | 描述 | 
|---|
| id string | 优惠券模板对象 ID,由 Ping++ 生成。 | 
| object string | 值为 coupon_template。 | 
| app string | 对应 app对象的id,查看 如何获取App ID。 | 
| livemode boolean | 是否处于 live 模式。 | 
| created int | 优惠券模板创建时间,用 Unix 时间戳表示。 | 
| name string | 优惠券模板名称。 | 
| type int | 优惠券模板的类型。取值包括 "1":现金券、"2":折扣券。 | 
| amount_off int | 折扣金额,在 type 为 1 时必传,取值范围 1~1000000000。 | 
| percent_off int | 折扣百分比,在 type 为 2 时必传。例如值为 "20" 表示 8 折,值为 "100" 表示免费。 | 
| discount_amount_limit int | 折扣上限,仅在 type 为 2 时生效。比如折扣上限为 20 元,当使用 8 折优惠券,订单金额为 200 元时,最高只可折扣 20 元,而非 40 元。 | 
| amount_available int | 订单金额大于等于该值时,优惠券有效(用于设置满减券)。"0" 表示无限制。 | 
| max_circulation int | 优惠券最大生成数量,当已生成数量达到最大值时,不能再生成优惠券;取值范围为 1 - 1000000。不填时默认为 null,表示可以无限生成。 | 
| max_user_circulation int | 单个用户优惠券最大生成数量,当已生成数量达到最大值时,不能再生成优惠券,删除优惠券不会影响该值;取值范围为 1 - 100,默认值为 1。 | 
| refundable boolean | 订单全额退款时是否退还优惠券。 | 
| expiration hash | 通过该优惠券模板创建的优惠券有效期规则,详见下方 expiration 参数说明 。 | 
| times_circulatedint | 优惠券生成数量。 | 
| times_redeemed int | 优惠券核销数量。 | 
| metadata hash | 详见 元数据。 | 
| expiration | 描述 | 
|---|
| time_start string | 优惠券可用的开始时间,用 Unix 时间戳表示。 | 
| time_end string | 优惠券可用的结束时间,用 Unix 时间戳表示。 | 
| duration int | 优惠券创建后的过期时间,单位为秒。不能和 time_start、time_end同时使用。 | 
示例对象
{
   "id": "300116082415452100000700",
   "object": "coupon_template",
   "app": "APP_ID",
   "amount_available": 10000,
   "amount_off": 25,
   "created": 1470904889,
   "expiration": null,
   "livemode": false,
   "max_circulation": 1000,
   "max_user_circulation":1,
   "metadata": {
   },
   "name": "25OFF",
   "percent_off": null,
   "refundable": true,
   "times_circulated": 0,
   "times_redeemed": 0,
   "type": 1
}